package cn.egame.extraction.dao;

import cn.egame.common.data.BaseDao;
import cn.egame.common.data.SqlUtils;
import cn.egame.common.exception.ExceptionCommonBase;
import cn.egame.extraction.pojo.GameTagLinkInfo;

public class GameTagLinkDao extends BaseDao {

	public GameTagLinkDao() throws ExceptionCommonBase {
		super("egame_game");
	}

	public void setGameTagLinkDao(GameTagLinkInfo gameTagLinkInfo)
			throws ExceptionCommonBase {
		String sql = "insert into t_game_tag_link (g_id,tag_id,game_sort_no,enable) values(%1$d,%2$d,%3$d,%4$d)  ON DUPLICATE KEY UPDATE " +
				" game_sort_no=%3$d , enable=%4$d"; 
		
		sql = String.format(sql, gameTagLinkInfo.getGId(),gameTagLinkInfo.getTagId(),gameTagLinkInfo.getGameSortNo(),gameTagLinkInfo.getEnable());
		this.executeUpdate(sql);
	}
	
	public void updateGameTagLinkDao(GameTagLinkInfo gameTagLinkInfo)
            throws ExceptionCommonBase {
        String sql = "update   t_game_tag_link  set  enable=%4$d where g_id =%1$d"; 
        
        sql = String.format(sql, gameTagLinkInfo.getGId(),gameTagLinkInfo.getTagId(),gameTagLinkInfo.getGameSortNo(),gameTagLinkInfo.getEnable());
        this.executeUpdate(sql);
    }
	


}
